<%@page import="java.util.StringTokenizer"%>
<%@page import="java.sql.*" %>
<%@ page import="com.hline.kbcss.MyDriver"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>::KBCSS::</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styles.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="mainbg">
<!-- header begins -->
<%String uname=(String)session.getAttribute("uname");
String userid=(String)session.getAttribute("userid");
//int uid=Integer.parseInt(userid);


%>

<div id="header">
	<div id="buttons">
		<div class="menu_width">
		<ul>
			   
			<li><a class="active">Welcome&nbsp;&nbsp;<%=uname%></a></li>

		
	
			
			
			<li><a href="logout.jsp" title="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Logout</a></li>
		</ul>
		</div>
	</div>
	<div id="logo">
		<a href="#">Knowledge Based Community Sharing System</a>
		<h5>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--Interaction With Industry</h5>
		
	</div>
<!-- header ends -->
<!-- content begins -->
<div id="main">
<div id="main_top"></div>
<div id="content_bg">
  <div id="content"></div>
  <div id="right"> </br>
    <h2>My Account</h2>
    <div class="categories">
       <ul>
        <li><a href="articles.jsp">Articles</a></li>        
        <li><a href="mat.jsp">Materials</a></li>
        <li><a href="res.jsp">Research papers</a></li>
        <li><a href="postma.jsp">Post Material/Research papers</a></li>
                <li><a href="postarticle.jsp">Post Articles</a></li>
        <li><a href="reports.jsp">Reports</a></li>
        <li><a href="cp.jsp">Change Password</a></li>
      </ul>
    </div>
  </div>
  <div class="rrr">
    <div class="spaa">
     
     <table width="97%" cellpadding="4" align="right">
         <tr>
          <td align="left" valign="top"><strong>Articles Report</strong></td>
          <td height="81" align="left" valign="top" colspan="2">&nbsp;</td>
        </tr>
        <tr align="center">
          <td ><strong>Article Name</strong></td>          
          <td ><strong>Like</strong></td>
          <td ><strong>Unlike</strong></td>
          
        </tr>
         <%
         String likes = "";
         StringTokenizer stLikes = null;
         Statement likesStmt = MyDriver.getConnection("READ");
         ResultSet likesRs = likesStmt.executeQuery("select field from hr where userid='"+userid+"'");
         if(likesRs.next()) {
			if(likesRs.getString(1)!=null || !likesRs.getString(1).equalsIgnoreCase("")) {     	
         		stLikes = new StringTokenizer(likesRs.getString(1), ",");
         	}
         	if(stLikes!=null) {
         		while(stLikes.hasMoreElements()) {
         			likes = likes + "'"+stLikes.nextElement()+"',";
         		}
         		likes = likes + "''";
         	}
         	}
         likesRs.close();
         likesStmt.close();
         
         
         
         
        Statement st12=MyDriver.getConnection("READ");
		ResultSet rs12=st12.executeQuery("select * from articles where field in ("+likes+") order by field, postedon");
		while(rs12.next())
		{
							  %>
							
        <tr align="center">
         <td ><%=rs12.getString("title")%> - [<%=((rs12.getInt("userid")<1000)?"USER":(rs12.getInt("userid")>1000 && rs12.getInt("userid")<10000)?"FACULTY":(rs12.getInt("userid")>10000)?"HR":"")%>]</td>
          <td ><%=rs12.getString("like1")%></td> 
          <td ><%=rs12.getString("unlike")%></td>           </tr>
  <%}%>
        
        <tr align="center">
         <td >&nbsp;</td>
          <td >&nbsp;</td> 
          <td >&nbsp;</td>          
        </tr>
        <tr align="center">
         <td >&nbsp;</td>
          <td >&nbsp;</td> 
          <td >&nbsp;</td>          
        </tr>
      </table>
      
      
    </div>
  </div>
</div>

</div>
</div>   
<!-- content ends -->
<!-- footer begins -->
<div id="footer">
  <p>Copyright  2011. Designed by <a href="#" title="Flash Templates">Knowledge Based Community Sharing System</a></p>
		<p><a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a> </div>
<!-- footer ends -->

</div>
</div>
</body>
</html>
